package com.wego.controller;

import com.wego.bean.IdName;
import com.wego.bean.TableBean;
import com.wego.converter.ProvinceConverter;
import com.wego.entity.domain.Province;
import com.wego.service.ProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 * 省份控制器
 *
 * @author Li Chuanwei
 */
@Controller
@RequestMapping("/manager/province")
public class ProvinceController {

    @Autowired
    private ProvinceService provinceService;

    @Autowired
    private ProvinceConverter provinceConverter;
    @GetMapping("list_id_name")
    public @ResponseBody List<IdName> list_Id_Name(){
        final List<Province> provinces = provinceService.selectAll();
        final List<IdName> provinceList = provinceConverter.provinceList2IdNameList(provinces);
        return provinceList;
    }
}
